﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:controls="clr-namespace:MediaElementExtensions.Controls"
                    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows">

    <!-- ProgressSlider Style
    You can modify the Default Style or Apply a new Style to the control
    but you have to add all the different named parts of this style
    otherwise the control wont work anymore
    -->
    <Style TargetType="controls:ProgressSlider">
        <!-- Properties are set by default -->
        <Setter Property="AutoDisableWhenNoSourceLoaded"
                Value="true" />
        <Setter Property="IsTabStop"
                Value="False" />
        <Setter Property="TrackLayerBrush"
                Value="#FFE6EFF7" />
        <Setter Property="TrackLayerDisabledBrush"
                Value="White" />
        <Setter Property="TrackLayerHeight"
                Value="2" />
        <Setter Property="TrackLayerStrokeBrush"
                Value="#FFE6EFF7" />
        <Setter Property="TrackLayerStrokeThickness"
                Value="0" />
        <Setter Property="DownloadLayerBrush"
                Value="LightBlue" />
        <Setter Property="DownloadLayerHeight"
                Value="4" />
        <Setter Property="DownloadLayerStrokeBrush"
                Value="DarkSlateGray" />
        <Setter Property="DownloadLayerStrokeThickness"
                Value="1" />
        <Setter Property="ThumbWidth"
                Value="25" />
        <Setter Property="ThumbHeight"
                Value="12" />
        <Setter Property="ThumbBackgroundBrush"
                Value="White" />
        <Setter Property="Minimum"
                Value="0" />
        <Setter Property="Maximum"
                Value="1" />
        <Setter Property="Orientation"
                Value="Horizontal" />
        <Setter Property="Value"
                Value="0" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:ProgressSlider">
                    <!-- Do NOT rename [ base class uses it ] -->
                    <Grid x:Name="Root">
                        <Grid.Resources>
                            <ControlTemplate x:Key="RepeatButtonTemplate">
                                <Grid x:Name="Root"
                                      Opacity="0"
                                      Background="Transparent" />
                            </ControlTemplate>
                        </Grid.Resources>
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualState x:Name="Normal" />
                                <vsm:VisualState x:Name="MouseOver" />
                                <vsm:VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HorizontalTrackRectangleDisabledOverlay"
                                                                       Storyboard.TargetProperty="Visibility"
                                                                       Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ThumbDisabledOverlay"
                                                                       Storyboard.TargetProperty="Visibility"
                                                                       Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>

                        <!-- Horizontal Template <=> Do NOT rename [ base class and I use it ] -->
                        <Grid x:Name="HorizontalTemplate"
                              Background="{TemplateBinding Background}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>

                            <!-- Download Layer <=> purpose: distinguish the downloaded part of the rest -->
                            <!-- Do NOT rename [ I use it in code behind ] -->
                            <Rectangle x:Name="PART_DownloadLayer"
                                       Fill="{TemplateBinding DownloadLayerBrush}"
                                       Height="{TemplateBinding DownloadLayerHeight}"
                                       Stroke="{TemplateBinding DownloadLayerStrokeBrush}"
                                       StrokeThickness="{TemplateBinding DownloadLayerStrokeThickness}"
                                       VerticalAlignment="Center"
                                       Grid.Column="0"
                                       Grid.ColumnSpan="3">
                                <Rectangle.RenderTransform>
                                    <!-- Do NOT remove the scaleTransform [ I use it in code behind ] -->
                                    <ScaleTransform ScaleX="0"
                                                    ScaleY="1" />
                                </Rectangle.RenderTransform>
                            </Rectangle>

                            <!-- Track Layer <=> Do NOT rename [ base classe uses it ] -->
                            <Rectangle x:Name="TrackRectangle"
                                       Stroke="{TemplateBinding TrackLayerStrokeBrush}"
                                       StrokeThickness="{TemplateBinding TrackLayerStrokeThickness}"
                                       Fill="{TemplateBinding TrackLayerBrush}"
                                       Grid.Column="0"
                                       Grid.ColumnSpan="3"
                                       Height="{TemplateBinding TrackLayerHeight}" />
                            <!-- Do NOT rename [ base class uses it ] -->
                            <Rectangle x:Name="HorizontalTrackRectangleDisabledOverlay"
                                       Visibility="Collapsed"
                                       Fill="White"
                                       Opacity=".55"
                                       Grid.Column="0"
                                       Grid.ColumnSpan="3"
                                       Height="{TemplateBinding TrackLayerHeight}"
                                       RadiusX="1"
                                       RadiusY="1"
                                       Margin="5,0,5,0" />

                            <!-- Left Repeat Buttons <=> Do NOT rename [ base class uses it ] -->
                            <RepeatButton x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton"
                                          Height="18"
                                          IsTabStop="False"
                                          Template="{StaticResource RepeatButtonTemplate}"
                                          Grid.Column="0" />
                            <!-- Left Side <=> Specify the display of the played part of the ProgressSlider -->
                            <!-- Do NOT rename [ I use it in code behind ] -->
                            <Rectangle x:Name="PART_LeftSide"
                                       Grid.Column="0"
                                       Fill="Transparent"
                                       Cursor="Hand" />

                            <!-- Thumb <=> Do NOT rename [ base class uses it ] -->
                            <Thumb x:Name="HorizontalThumb"
                                   Grid.Column="1"
                                   Width="{TemplateBinding ThumbWidth}"
                                   Height="{TemplateBinding ThumbHeight}"
                                   Background="{TemplateBinding ThumbBackgroundBrush}"
                                   IsTabStop="True">
                                <Thumb.Template>
                                    <ControlTemplate>
                                        <Grid>
                                            <vsm:VisualStateManager.VisualStateGroups>
                                                <vsm:VisualStateGroup x:Name="CommonStates">
                                                    <vsm:VisualState x:Name="Normal" />
                                                    <vsm:VisualState x:Name="MouseOver">
                                                        <Storyboard>
                                                            <ColorAnimationUsingKeyFrames BeginTime="00:00:00"
                                                                                          Duration="00:00:00.0010000"
                                                                                          Storyboard.TargetName="recThumb"
                                                                                          Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
                                                                <EasingColorKeyFrame KeyTime="00:00:00"
                                                                                     Value="Red" />
                                                            </ColorAnimationUsingKeyFrames>
                                                        </Storyboard>
                                                    </vsm:VisualState>
                                                </vsm:VisualStateGroup>
                                            </vsm:VisualStateManager.VisualStateGroups>
                                            <Rectangle x:Name="recThumb"
                                                       Fill="{TemplateBinding Background}"
                                                       Width="{TemplateBinding Width}"
                                                       Height="{TemplateBinding Height}"
                                                       VerticalAlignment="Center"
                                                       RadiusX="3"
                                                       RadiusY="3" />
                                        </Grid>
                                    </ControlTemplate>
                                </Thumb.Template>
                            </Thumb>
                            <!-- ThumbDisabledOverlay <=> Do NOT rename [ base class uses it ] -->
                            <Rectangle x:Name="ThumbDisabledOverlay"
                                       RadiusX="3"
                                       RadiusY="3"
                                       VerticalAlignment="Center"
                                       Width="{TemplateBinding ThumbWidth}"
                                       Height="{TemplateBinding ThumbHeight}"
                                       Grid.Column="1"
                                       Fill="White"
                                       Opacity=".55"
                                       Visibility="Collapsed" />

                            <!-- Right Repeat Buttons <=> Do NOT rename [ base class uses it ] -->
                            <!-- Do NOT rename [ base class uses it ] -->
                            <RepeatButton x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton"
                                          Height="18"
                                          Cursor="Hand"
                                          IsTabStop="False"
                                          Template="{StaticResource RepeatButtonTemplate}"
                                          Grid.Column="2" />
                            <!-- Right Side <=> Specify the display of the part not yet played -->
                            <!-- Do NOT rename [ I use it in code behind ] -->
                            <Rectangle x:Name="PART_RightSide"
                                       Grid.Column="2"
                                       Fill="Transparent"
                                       Cursor="Hand" />

                        </Grid>

                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- VolumeSlider Style
    You can modify the Default Style or Apply a new Style to the control
    but you have to add all the different named parts of this style
    otherwise the control wont work anymore
    -->
    <Style TargetType="controls:VolumeSlider">
        <!-- Properties are set by default -->
        <Setter Property="AutoDisableWhenNoSourceLoaded"
                Value="true" />
        <Setter Property="AutoDisableWhenMuted"
                Value="true" />
        <Setter Property="IsTabStop"
                Value="False" />
        <Setter Property="Orientation"
                Value="Horizontal" />
        <Setter Property="Minimum"
                Value="0" />
        <Setter Property="Maximum"
                Value="1" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:VolumeSlider">
                    <!-- Do NOT rename [ base class uses it ] -->
                    <Grid x:Name="Root">
                        <Slider Orientation="{TemplateBinding Orientation}"
                                Width="{TemplateBinding Width}"
                                Height="{TemplateBinding Height}"
                                Minimum="{TemplateBinding Minimum}"
                                Maximum="{TemplateBinding Maximum}"
                                Value="{Binding Value, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <!-- StopButton Style
    You can modify the Default Style or Apply a new Style to the control
    but you have to add all the different named parts of this style
    otherwise the control wont work anymore
    -->
    <Style TargetType="controls:StopButton">
        <!-- Properties are set by default -->
        <Setter Property="AutoDisableWhenNoSourceLoaded"
                Value="true" />
        <Setter Property="AutoDisableWhenStopped"
                Value="true" />
        <Setter Property="IsTabStop"
                Value="True" />
        <Setter Property="CornerRadius"
                Value="2" />
        <Setter Property="FillBrush"
                Value="White" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="controls:StopButton">
                    <!-- Do NOT rename [ base class uses it ] -->
                    <Grid x:Name="Root" Margin="{TemplateBinding Margin}">
                        <Border CornerRadius="{TemplateBinding CornerRadius}" >
                            <Rectangle Width="{TemplateBinding Width}"
                                       Height="{TemplateBinding Height}"
                                       Fill="{TemplateBinding FillBrush}" />
                        </Border>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>